﻿using System;
using System.Data.EntityClient;

namespace EntityFrameworkVisualizer.VisualizerObjectSources
{
    /// <summary>
    /// Visualizer for <see cref="EntityCommand"/>.
    /// </summary>
    public class EntityCommandVisualizerObjectSource : QueryVisualizerObjectSource<EntityCommand>
    {
        /// <summary>
        /// Gets SQL source code.
        /// </summary>
        /// <param name="target">Target object.</param>
        /// <returns>SQL source code.</returns>
        protected override string GetSql(EntityCommand target)
        {
            if (target == null)
            {
                return null;
            }

            return target.ToTraceString();
        }
    }
}
